namespace Text2Rss.Web.Code
{
	/// <summary>
	/// Base class for entities
	/// </summary>
	public abstract class VersionedEntity<TId> : Entity<TId>
	{
		/// <summary>
		/// Gets or sets version of the entity
		/// </summary>
		public virtual int Version { get; protected set; }

		/// <summary>
		/// Return true if the entity is transient. Transient entities doesn't exist in the storage
		/// </summary>
		/// <returns>True if the entity is transient</returns>
		public override bool IsTransient()
		{
			return Version == 0;
		}
	}
}
